﻿Module Module1

    Public Function EnHex(Data As String) As String
        '|||
        '||| Written by someone else - sufficient, no need to rewrite it
        '|||

        On Error Resume Next

        Dim iCount As Double
        Dim sTemp As String
        Dim strReturn As String = ""

        For iCount = 1 To Len(Data)
            sTemp = Hex$(Asc(Mid$(Data, iCount, 1)))
            If Len(sTemp) < 2 Then sTemp = "0" & sTemp
            strReturn = strReturn & sTemp
        Next

        Return strReturn

    End Function

    Public Function DeHex(Data As String) As String
        '|||
        '||| Written by someone else - sufficient, no need to rewrite it
        '|||

        On Error Resume Next

        Dim iCount As Double
        Dim strReturn As String = ""

        For iCount = 1 To Len(Data) Step 2
            strReturn = strReturn & Chr(Val("&H" & Mid$(Data, iCount, 2)))
        Next

        Return strReturn

    End Function

End Module
